home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / proto212.zip / EXAMPLE.ZIP / MAKEFILE < prev    next >
Text File  |  1992-01-24  |  3KB  |  93 lines

  1. #Example of most capabilities of Solucorp Make
  2.  
  3. #Solve DOS command line limitation for command.
  4. #    It tells make how to create a command file, how to insert
  5. #    continuation character, and how to call the utility.
  6. #    for now on cc and lib may accept command line of any length.
  7. .indir.cc  = c:\cc.$$$    @c:\cc.$$$
  8. .indir.lib = c:\lib.$$$,& @c:\cc.$$$
  9.  
  10. #Solve DOS 640k limit selectivly.
  11. #    It tells make that it must swap itself only when executing command
  12. #    cc make and proto
  13. .huge   = cc make proto
  14.  
  15. #Macro definition.
  16. #    macro SOURCE will hold a list of all C file in the current directory
  17. #    except main.c
  18. SOURCE  ? *.c -main.c
  19.  
  20. # Compiler flags for all .c file
  21. CFLAGS = -O
  22. # Compiler flags for some .c file
  23. # See the comments in the .c.$(OBJEXT) rule
  24. source2.CFLAGS = -n
  25.  
  26. #    macro DIROBJ will hold a path. This path will be any of three possible.
  27. #    The first one that exist will be used.
  28. DIROBJ  | c:\obj d:\obj .
  29.  
  30. #access control.
  31. #    This tells where the object (.obj) files should be placed
  32. #    and look for.
  33. .path.obj = $(DIROBJ)
  34.  
  35. #    This tells where the header must be looked for, for depandency check.
  36. .path.h   = . ..\include \compiler\include
  37.  
  38. #These are the general rules for rebuilding a librairy.
  39. #    The preprocessor is used to create portable makefiles.
  40. !if $d(MSDOS)
  41. OBJEXT  = obj   # Extension of object files on MSDOS
  42. LIBEXT  = lib   # Extension of library files on MSDOS
  43. !else
  44. OBJEXT  = o     # Extension of object files on UNIX
  45. LIBEXT  = a     # Extension of library files on UNIX
  46. !endif
  47.  
  48. #implicit rules for source translation into object file
  49. .c.$(EXTOBJ):
  50.     # Generalisition of macro usage: Object oriented macro facility
  51.     # $& expands to the name of the current module
  52.     # $($&.CFLAGS) expand to whatever options appropriate for
  53.     # the current module being compiled.
  54.     cc -c $($&.CFLAGS) $(CFLAGS) $&.c
  55.  
  56. #General rules
  57. #    lib.lib is builted from .obj file, not .c. Macro SOURCE holds a list
  58. #    of .c. This syntax allows editing of the list.
  59. #    The builtin macro $? let you update the librairie
  60. #    with only .obj (.o) files which outdated lib.lib (lib.a).
  61. lib.$(LIBEXT): $(SOURCE:%b.$(OBJEXT))
  62.     # True subroutine capacity, see !define lib below
  63.     !use lib $< "$?"
  64.  
  65.  
  66. #Documentation preparation.
  67. #    Here is the sequence that has been used to create the files
  68. #    that are documented in document.exm.
  69. doc:
  70.     proto -cod -fxsys.nap *.c           # Produce xsys.nap file
  71.     naperm xsys.nap xsys.nai xsys.nas xsys.nah
  72.     nadoc xsys.doc xsys.nap xsys.ref    # Produce the reference manual
  73.  
  74. #Automatic dependancies creation.
  75. #    The file makefile.dep is created by scanning all the sources in
  76. #    the current directory. This file is silently processed by
  77. #    Make to establish the dependancies between source files and headers.
  78. dep:
  79.     makedep makefile *.c
  80.  
  81. # Subroutine capacity. This is the key to makefile portability
  82. !define lib libname objects
  83.     !if $d(MSDOS)
  84.         # A "-+" is added before each obj file.
  85.         lib $(libname) $(objects:-+%s)
  86.     !else
  87.         # Update lib.a on UNIX
  88.         ar $(libname) $(objects)
  89.         ranlib $(libname)
  90.     !endif
  91. !enddef
  92.  
  93.